package sh.grapendaal.tsuushin.module.uno.engine.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import sh.grapendaal.tsuushin.module.uno.engine.domain.Card;
import sh.grapendaal.tsuushin.module.uno.engine.domain.Playable;

public class GameState implements Serializable {

	private static final long serialVersionUID = -3947246595388036388L;

	private Card topCard;
	private List<PlayerState> players;
	private PlayerState currentPlayer;
	private PlayerState nextPlayer;
	private GameAction lastAction;
	private Playable played;

	public Card getTopCard() {
		return topCard;
	}

	public void setTopCard(Card topCard) {
		this.topCard = topCard;
	}

	public List<PlayerState> getPlayers() {
		return players;
	}

	public void setPlayers(List<PlayerState> players) {
		this.players = players;
	}

	public PlayerState getCurrentPlayer() {
		return currentPlayer;
	}

	public void setCurrentPlayer(PlayerState currentPlayer) {
		this.currentPlayer = currentPlayer;
	}

	public PlayerState getNextPlayer() {
		return nextPlayer;
	}

	public void setNextPlayer(PlayerState nextPlayer) {
		this.nextPlayer = nextPlayer;
	}

	public GameAction getLastAction() {
		return lastAction;
	}

	public void setLastAction(GameAction lastAction) {
		this.lastAction = lastAction;
	}

	public Playable getPlayed() {
		return played;
	}

	public void setPlayed(Playable played) {
		this.played = played;
	}
	
	public GameState clone() {
		GameState gameState = new GameState();
		gameState.setTopCard(this.topCard);
		gameState.setPlayers(this.players == null ? null : new ArrayList<PlayerState>(this.players));
		gameState.setCurrentPlayer(this.currentPlayer);
		gameState.setNextPlayer(this.nextPlayer);
		gameState.setLastAction(this.lastAction);
		gameState.setPlayed(this.played);
		return gameState;
	}
}
